//
//  PGIndexBannerSubiew.m
//  NewPagedFlowViewDemo
//
//  Created by Mars on 16/6/18.
//  Copyright © 2016年 Mars. All rights reserved.
//  Designed By PageGuo,
//  QQ:799573715
//  github:https://github.com/PageGuo/NewPagedFlowView

#import "PGIndexBannerSubiew.h"

@implementation PGIndexBannerSubiew

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _bottomView = [[UIView alloc] init];
        [self addSubview:_bottomView];
        [_bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self);
            make.height.mas_equalTo(scaleTopAndBottom(60));
        }];
        _mainImageView=[[UIImageView alloc]init];
         [self addSubview:self.mainImageView];
        [_mainImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self);
            make.top.equalTo(self.mas_top).offset(scaleTopAndBottom(5));
            make.bottom.equalTo(_bottomView.mas_top);
        }];
        _mainImageView.userInteractionEnabled = YES;
        _mainImageView.layer.cornerRadius = scaleTopAndBottom(4);
        _mainImageView.layer.masksToBounds = YES;

    }
    return self;
}

//- (UIImageView *)mainImageView {
//    
//    if (_mainImageView == nil) {
//
////        _mainImageView = [[UIImageView alloc] initWithFrame:self.bounds];
//               _mainImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
//        [_mainImageView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.top.right.equalTo(self);
//            make.bottom.equalTo(_bottomView.mas_top);
//        }];
//        
//        
//        _mainImageView.userInteractionEnabled = YES;
////        [_mainImageView addSubview:self.titleLabel];
////        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
////            make.centerX.equalTo(_mainImageView.mas_centerX);
////            make.bottom.equalTo(_mainImageView);
////            make.height.mas_equalTo(_mainImageView.mas_height).multipliedBy(0.2);
////        }];
//    }
//    return _mainImageView;
//}

-(UILabel *)titleLabel{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}
@end
